import 'package:flutter/material.dart';
import 'package:t2app/src/Config.dart';
import 'package:t2app/src/view/my/My.dart';
import 'package:t2app/src/view/yesServer/YesServer_Index.dart';
import '../view/noServer/NoServer_Index.dart';

class Home extends StatefulWidget {
  @override
  _TabState createState() => _TabState();
}

class _TabState extends State<Home> {

  int _currentIndex=0;
  List _list=[
    NoServer_Index(),
    YesServer_Index(),
    MyView(),
  ];

  @override
  void initState() {
    super.initState();
  }
  @override
  Widget build(BuildContext context) {

    Config.initConfigEasyLoading(); //交互组件

/*    if(!Tool.checkUserInfo()){
      return LoginView();
    }*/
    return Scaffold(
      body: this._list[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: this._currentIndex,
        selectedLabelStyle: const TextStyle(fontWeight: FontWeight.bold),
        unselectedLabelStyle: const TextStyle(fontWeight: FontWeight.bold),
        onTap: (int index){
          setState(() {
            _currentIndex=index;
          });
        },
        iconSize:30,//icon大小
        backgroundColor: Config.THEME.primaryColorLight,
        fixedColor:Config.THEME.primaryColor,//选中颜色
        type: BottomNavigationBarType.fixed,//配置底部tabs可以有多个，不会被挤下去
        items: [
          BottomNavigationBarItem(
              icon: Icon(Icons.workspaces_outline),
              label: '×服务端'
          ),
          BottomNavigationBarItem(
              icon: Icon(Icons.workspaces),
              label: '√服务端'
          ),
          BottomNavigationBarItem(
              icon: Icon(Icons.person),
              label: '个人中心'
          )
        ],
      ),
    );
  }
}